package com.estate.common.core.domain.resp;

import com.estate.common.core.domain.entity.SysDept;
import com.estate.common.utils.bean.BeanUtils;
import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 菜单表 sys_dept
 * 
 * @author ruoyi
 */
@Data
public class SysDeptResp implements Serializable
{
    private static final long serialVersionUID = 1L;

    private Long id;

    private String type;

    /** 父部门ID */
    private Long parentId;

    /** 父部门名称 */
    private String parentName;

    private String name;

    /** 部门状态:0正常,1停用 */
    private String status;

    private List<SysDeptResp> children;

    public SysDeptResp()
    {

    }

    public SysDeptResp(SysDept dept)
    {
        BeanUtils.copyBeanProp(this, dept);
        this.id = dept.getDeptId();
        this.name = dept.getDeptName();
        this.children = dept.getChildren().stream().map(SysDeptResp::new).collect(Collectors.toList());
    }

}
